
var urldefault = 'http://'+location.hostname;

var descdefault = "现在加入哇吖，每推荐一人即可领取5欧元现金奖励"
    +"现在就将推荐码分享给您的朋友们吧！更多的现金奖励在等着你哦！";
var titledefault = "哇吖自由行";
var imgdefault  = 'http://www.wayatrip.com/resource/www/imgs/logo.png';


function shares(type,title,desc,invurl,img)
{
    var Title=arguments[1]?title:titledefault;
    var Description=arguments[2]?desc:descdefault;
    var InviteUrl=arguments[3]?invurl:urldefault;
    var ShareImg=arguments[4]?img:imgdefault;
    if(type == 'sina')
    {
        ShareToSina(Title,Description,InviteUrl,ShareImg);
    }
    else if(type == 'tenxun')
    {
        ShareToTenxun(Title,Description,InviteUrl,ShareImg);
    }
    else if(type == 'qzone')
    {
        ShareToQQZone(Title,Description,InviteUrl,ShareImg);
    }
    else if(type == 'renren')
    {
        ShareToRenRen(Title,Description,InviteUrl,ShareImg);
    }
    else if(type == 'weixin')
    {
        ShareToWeixin('',Description,InviteUrl,'');
    }
    else if(type  == 'qq')
    {
        ShareToQQ(Title,Description,InviteUrl,ShareImg);
    }
}

//分享到新浪微博
ShareToSina = function(title,desc,url,picurl)
{
    title = desc;
    url = encodeURIComponent(url);
    var sharesinastring = 'http://service.weibo.com/share/share.php?ralateUid=5777431369&language=zh_cn&appkey=4155679762&searchPic=false&title='+title+'&url='+url+'&content=utf-8&sourceUrl='+url+'&pic='+picurl;
    window.open(sharesinastring,'newwindow');
}

//分享到腾讯微博
ShareToTenxun = function(title,desc,url,picurl)
{
    var contentID = Math.floor(Math.random() * sharecontent.length);
    title = encodeURIComponent(sharecontent[contentID] + InviteUrl);
    var sharetenxunstring = 'http://share.v.t.qq.com/index.php?c=share&a=index&title='+title+'&url=&content=utf-8&pic='+picurl;
    window.open(sharetenxunstring,'newwindow');
}

//分享到qq
ShareToQQ = function(title,desc,url,picurl)
{
    title = encodeURIComponent(desc + url);
    var sharetenxunstring = 'http://connect.qq.com/widget/shareqq/index.html?title='+title+'&url='+encodeURIComponent(url)+'&pics='+picurl;
    window.open(sharetenxunstring,'newwindow');
}

//分享到QQ空间
ShareToQQZone = function(title,desc,url,picurl)
{
    var summary = encodeURIComponent(desc + url);
    var shareqqzonestring = 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?title='+title+'&url='+encodeURIComponent(url)+'&pics='+picurl + '&summary='+summary+'&desc='+summary;
    window.open(shareqqzonestring,'newwindow');
}

//分享到人人
ShareToRenRen = function(title,desc,url,picurl)
{
    var description = encodeURIComponent(desc + url);
    var shareRenRenString = 'http://widget.renren.com/dialog/share?resourceUrl=' + encodeURIComponent(url) + '&pic=' + picurl + '&title=' + title + '&description='+ description + '&charset=UTF-8';
    window.open(shareRenRenString,'newwindow');
}

//分享到微信
ShareToWeixin = function(title,desc,url,picurl)
{
    var shareweixinstring = 'http://api.kuaipai.cn/qr?chs=120x120&chl=' + url;
    window.open(shareweixinstring,'newwindow','height=400,width=400,top=100,left=100');
}


